package com.pptiku.jh.routerdemo.dagger2.module;

import com.pptiku.jh.routerdemo.User;
import com.pptiku.jh.routerdemo.dagger2.annotation.ForTest;
import com.pptiku.jh.routerdemo.dagger2.components.quali.MUser;
import com.pptiku.jh.routerdemo.dagger2.components.quali.SUser;

import javax.inject.Named;
import javax.inject.Singleton;

import dagger.Module;
import dagger.Provides;

/**
 * Created by ytf on 2018/6/1.
 * Description:
 */
@Module
public class UserModule
{
    @Provides
    @MUser
    User provideUser()
    {
       return new User("aaa");
    }

    @Provides
    @ForTest
    User provideTestUser()
    {
        return new User("test");
    }

    @Provides
    String provideUserName(@ForTest User u)
    {
        return u.name;
    }

    @Provides
    @SUser
    String provideUserName2(@MUser User u)
    {
        return u.name;
    }
}
